package com.gitee.smsdistribution.model;

import com.gitee.smsdistribution.validate.OnInsert;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

@Entity
@Table(name = "sms_info")
@Data
@Accessors(chain = true)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class SmsInfo implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @NotBlank(message = "公司名称不能为空", groups = OnInsert.class)
    private String company;
    @NotBlank(message = "公司联系人不能为空", groups = OnInsert.class)
    private String contact;
    @NotBlank(message = "手机号不能为空", groups = OnInsert.class)
    private String phone;
    @NotBlank(message = "关联模板不能为空", groups = OnInsert.class)
    private String templateName;
    private Date sendDate;

    @Enumerated(EnumType.STRING)
    private SendState sendState = SendState.UNSENT;
}
